home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / P_ROBO31.ZIP / SUPREMO.PR < prev    next >
Text File  |  1989-11-14  |  3KB  |  110 lines

  1. PROCEDURE Supremo;
  2.  
  3.                        { This robot takes his tracking and
  4.                          shooting style from the C-Robot by
  5.                          Hortense Endoh, and combines it with
  6.                          the Runner type technique from T.Harnish.
  7.                          The difference is that he stays farther
  8.                          away from walls (like the inside corners
  9.                          of a picture frame) and also crosses the
  10.                          field diagonally. One on one, he's tough.
  11.  
  12.                                       Rick Bross              }
  13.  
  14. VAR
  15.    Deg,Dir,Spd : Integer;
  16. PROCEDURE Shoot(Dir,Spd : Integer);  {Track and shoot}
  17. VAR
  18.    Range : Integer;
  19. BEGIN
  20.    Drive(Dir,Spd);
  21.    Range := Scan(Deg,10);
  22.    IF Range > 39 THEN
  23.       Cannon(Deg,Range)
  24.    ELSE
  25.       BEGIN
  26.          Deg := Deg + 20;
  27.          IF Scan(Deg,10) = 0 THEN
  28.             BEGIN
  29.                Deg := Deg - 40;
  30.                IF Scan(Deg,10) = 0 THEN
  31.                   BEGIN
  32.                      Deg := Deg + 60;
  33.                      IF Scan(Deg,10) = 0 THEN
  34.                         Deg := Deg - 80;
  35.                         WHILE Scan(Deg,10) = 0 DO
  36.                            Deg := Deg + 20;
  37.                   END;
  38.             END;
  39.          Cannon(Deg,Scan(Deg,10));
  40.       END;
  41. END;
  42.  
  43. BEGIN
  44.    Dir := Angle_To(0,999);
  45.    WHILE (Loc_X > 230) AND (Loc_Y < 770) DO {Travel to upper left}
  46.       Shoot(Dir,100); {Shoot the whole way, of course!}
  47.    Drive(Dir,0); {Need this to slow down in time.}
  48.    WHILE (Speed > 50) DO {Slow down}
  49.       Shoot(Dir,0); {Still shooting}
  50.  
  51.    REPEAT {Go down left side}
  52.       WHILE (Loc_Y > 230) DO
  53.          Shoot(270,100);
  54.       Drive(270,0); {Need this to slow down in time}
  55.       WHILE (Speed > 50) DO {Slow down}
  56.          Shoot(270,0);
  57.  
  58.       {Go across bottom}
  59.       WHILE (Loc_X < 770) DO
  60.          Shoot(0,100);
  61.       Drive(0,0);
  62.       WHILE (Speed > 50) DO
  63.          Shoot(0,0);
  64.  
  65.       {Go up right side}
  66.       WHILE (Loc_Y < 770) DO
  67.          Shoot(90,100);
  68.       Drive(90,0);
  69.       WHILE (Speed > 50) DO
  70.          Shoot(90,0);
  71.  
  72.       {Go from upper right to lower left}
  73.       WHILE (Loc_Y > 230) DO
  74.          Shoot(225,100);
  75.       Drive(225,0);
  76.       WHILE (Speed > 50) DO
  77.          Shoot(225,0);
  78.  
  79.       {Go up left side}
  80.       WHILE (Loc_Y < 770) DO
  81.          Shoot(90,100);
  82.       Drive(90,0);
  83.       WHILE (Speed > 50) DO
  84.          Shoot(90,0);
  85.  
  86.       {Go from upper left to lower right}
  87.       WHILE (Loc_X < 770) DO
  88.          Shoot(315,100);
  89.       Drive(315,0);
  90.       WHILE (Speed > 50) DO
  91.          Shoot(315,0);
  92.  
  93.       {Go up right side}
  94.       WHILE (Loc_Y < 770) DO
  95.          Shoot(90,100);
  96.       Drive(90,0);
  97.       WHILE (Speed > 50) DO
  98.          Shoot(90,0);
  99.  
  100.       {Go across top}
  101.       WHILE (Loc_X > 230) DO
  102.          Shoot(180,100);
  103.       Drive(180,0);
  104.       WHILE (Speed > 50) DO
  105.          Shoot(180,0);
  106.  
  107.     UNTIL Dead OR Winner;
  108.  
  109.   END; { End Supremo Main }
  110.